package com.hyfd.controller.mp;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hyfd.controller.sys.BaseController;
import com.hyfd.service.mp.AgentDataDiscountSer;

@Controller
// @Scope("prototype") //开启非单例模式 用于并发控制
public class AgentDataDiscountCtl extends BaseController
{
    
    @Autowired
    private AgentDataDiscountSer agentDataDiscountSer;
    
    /**
     * 跳转到列表页面 使用get方式提交
     * 
     * @param req
     * @return
     */
    @GetMapping("agentDataDiscountListPage/{id}")
    public String agentDataDiscountListPage(@PathVariable("id") String id, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountListPage(id, req);
    }
    
    /**
     * 获取列表数据 只能使用get方式提交
     * 
     * @param req
     * @return
     */
    @GetMapping("agentDataDiscount/{id}")
    @ResponseBody
    public String agentDataDiscountGet(@PathVariable("id") String agentId, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountList(agentId, req);
    }
    
    /**
     * @功能描述： 不分页根据条件获取全部代理商流量折扣列表数据
     *
     * @param req
     * @return
     */
    @GetMapping("agentDataDiscountAll")
    @ResponseBody
    public String agentDataDiscountAllGet(HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountAllList(req);
    }
    
    /**
     * 代理商流量折扣添加页面显示 只能使用get方式提交
     * 
     * @return
     */
    @GetMapping("agentDataDiscountAddPage/{id}")
    public String agentDataDiscountAddPage(@PathVariable("id") String id, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountAdd(id, req);
    }
    
    /**
     * 查询流量包折扣价格
     * */
    @GetMapping("agentDataDiscountGet")
    @ResponseBody
    public String agentDataDiscount(HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountGet(req);
    }
    
    /**
     * 创建代理商流量折扣对象只能用post方式来提交
     * 
     * @param req
     * @return
     */
    @PostMapping("agentDataDiscount")
    public String agentDataDiscountPost(HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountAdd(req);
    }
    
    /**
     * 显示详单页面要使用get方法并要在请求路径中传入代理商流量折扣编号数据
     * 
     * @param id
     * @return
     */
    @GetMapping("agentDataDiscountDetailPage/{id}")
    public String agentDataDiscountDetailPage(@PathVariable("id") String id, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountDetailPage(id, req);
    }
    
    /**
     * 详情页面数据
     * */
    @GetMapping("agentDataDiscountDetail/{id}")
    @ResponseBody
    public String agentDataDiscountDetail(@PathVariable("id") String id, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountDetail(id, req);
    }
    
    /**
     * 详情页面数据
     * */
    @GetMapping("agentDataDiscountDetailPkgList/{id}")
    @ResponseBody
    public String agentDataDiscountDetailPkgList(@PathVariable("id") String id, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountPkgList(id, req);
    }
    
    /**
     * 显示编辑页面请求路径中要包括需要修改的agentId
     * 
     * @param id
     * @return
     */
    @GetMapping("agentDataDiscountEditPage/{id}")
    @ResponseBody
    public String agentDataDiscountPage(@PathVariable("id") String id, HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountPage(id, req);
    }
    
    // /**
    // * 跳转到修改页面
    // * @param id
    // * @return
    // */
    // @GetMapping("agentDataDiscountEditPage")
    // public String agentDataDiscountEditPage(HttpServletRequest req) {
    // return agentDataDiscountSer.agentDataDiscountEditPage(req);
    // }
    
    // /**
    // * 更新代理商流量折扣信息 只能用put方式提交
    // * @param id
    // * @param req
    // * @param res
    // * @return
    // */
    // @PutMapping("agentDataDiscount")
    // @ResponseBody
    // public String agentDataDiscountPut(HttpServletRequest req) {
    // return agentDataDiscountSer.agentDataDiscountEdit(req);
    // }
    
    /**
     * 修改折扣信息
     * */
    @PutMapping("agentDataDiscountUpdate")
    @ResponseBody
    public String agentDataDiscountUpdate(HttpServletRequest req)
    {
        return agentDataDiscountSer.agentDataDiscountUpdate(req);
    }
    
    // /**
    // * 删除代理商流量折扣
    // * @param id
    // * @param req
    // * @param res
    // * @return
    // */
    // @DeleteMapping("agentDataDiscount/{id}")
    // @ResponseBody
    // public String agentDataDiscountDel(@PathVariable("id") String agentId,HttpServletRequest req) {
    // return agentDataDiscountSer.agentDataDiscountDel(agentId,req) ;
    // }
    
    /**
     * @Title:queryAgentDiscountBySuId
     * @Description: TODO(这里用一句话描述这个方法的作用)
     * @author CXJ
     * @date 2017年6月9日 下午4:03:17
     * @param @param agentId
     * @param @return
     * @return String 返回类型
     * @throws
     */
    @GetMapping("queryAgentDiscountBySuId/{suId}")
    @ResponseBody
    public String queryAgentDiscountBySuId(@PathVariable("suId") String suId, HttpServletRequest req)
    {
        return agentDataDiscountSer.queryAgentDiscountBySuId(suId, req);
    }
    
    /**
     * @Title:queryAgentDiscountBySuId
     * @Description: TODO(这里用一句话描述这个方法的作用)
     * @author CXJ
     * @date 2017年6月9日 下午4:03:17
     * @param @param agentId
     * @param @return
     * @return String 返回类型
     * @throws
     */
    @GetMapping("queryAgentBillDiscountBySuId/{suId}")
    @ResponseBody
    public String queryAgentBillDiscountBySuId(@PathVariable("suId") String suId, HttpServletRequest req)
    {
        return agentDataDiscountSer.queryAgentBillDiscountBySuId(suId, req);
    }
}
